﻿#pragma once

#include <string>
#include <unordered_map>
#include <vector>

class Logger;

class ProductInfo {
  std::string file1Path;
  int unitPriceIndex{ -1 };
  int IDIndex{ -1 };
  int BarCodeIndex{ -1 };

  bool readInfoSucc{ false };
  Logger &logObj;

  std::vector<std::string> header;
  std::unordered_map<std::string, std::vector<std::string>> data;

  bool ReadProductFile();
public:
  explicit ProductInfo(const std::string &file, Logger& log);

  bool InitSucc()const { return readInfoSucc; }

  void ParseSellData(const std::string& sellFile);

  //static std::string KeyColName() { return "商品名称"; }
  static std::string ProduceNameColName() { return "商品全名"; }
  static std::string IDColName() { return "商品编号"; }
  //static std::string BarCodeColName() { return "商品条码"; }
  static std::string BarCodeColName() { return "条码"; }
  static std::string UnitPriceColName() { return "零售价"; }
};
